<#import "/spring.ftl" as s/>
<@override name="styles">
<link rel="stylesheet" type="text/css" href="<@s.url '/resources/common/css/jquery-picklist.css'/>"/>
<!--[if !IE]><!-->
<link rel="stylesheet" type="text/css" href="<@s.url '/resources/common/css/jquery-picklist-ie7.css'/>"/>
<!--<![endif]-->
<style type="text/css">
    #rich button{ }
</style>
</@override>
<@override name="main">
<div id="project_form_div">
    <form id="project_form" action="<@s.url '/project/save'/>" method="post">

        <input id="id" name="id" type="hidden" value="${id}"/>
        <input id="lead" name="lead" type="hidden" value="${project.lead}"/>
        <input id="dev_leader" name="dev_leader" type="hidden" value="${project.dev_leader}"/>
        <table art="form" columns="120,*" autoLabel="true" rightAlign="true" colon="true">
            <tr>
                <td>
                    <label art='label' for="name" required='true'><@s.message "project.form.name"/></label>
                </td>
                <td>
                    <input id="name" name="name" type="text" art="textbox" emptyText="<@s.message "project.empty.form.name"/>"   requiredMsg= "<@s.message "project.edit.name.required.error.tip"/>"
                           errorMsg="<@s.message "project.edit.name.error.tip"/>"    required="true" value="${project.name?html}" validType="length[0,50]" display='right'/>
                </td>
            </tr>
            <tr>
                <td>
                    <label for="code" art='label' required='true'><@s.message "project.form.code"/></label>
                </td>
                <td>
					<#if project.code=="">
                        <input id="code" name="code" type="text" art="textbox" required='true' value="${project.code?html}"validType="length[0,30]" display='right'  requiredMsg="<@s.message "project.edit.key.required.error.tip"/>" errorMsg="<@s.message "project.edit.key.error.tip"/>"emptyText="<@s.message "project.empty.form.code"/>" />
                    <#else>
                        <input id="code" name="code" type="text" art="textbox" required='true' value="${project.code?html}"validType="length[0,30]" display='right'  requiredMsg="<@s.message "project.edit.key.required.error.tip"/>" errorMsg="<@s.message "project.edit.key.error.tip"/>" emptyText="<@s.message "project.empty.form.code"/>" readonly="readonly"/>
					</#if>
                </td>
            </tr>
            <tr>
              <td>
                 <label for="svn_url" art='label' required='true'><@s.message "project.form.svn"/></label>
            </td>
              <td>
                <input id="svn_url" name="svn_url" type="text" art="textbox" required='true' value="${project.svn_url?html}" display='right'  requiredMsg="<@s.message "project.edit.svn.required.error.tip"/>" errorMsg="<@s.message "project.edit.key.error.tip"/>"emptyText="<@s.message "project.empty.form.svn"/>" />
              </td>
            </tr>
            <tr>
                <td>
                    <label for="url" art='label' required='true'><@s.message "project.form.url"/></label>
                </td>
                <td>
                    <input id="url" name="url" type="text" art="textbox" validType="url" required='true' value="${project.url?html}"validType="length[0,150]" display='right' errorMsg="<@s.message "project.edit.url.error.tip"/>" requiredMsg="<@s.message "project.edit.url.required.error.tip"/>" emptyText="<@s.message "project.empty.form.url"/>"/>
                </td>
            </tr>
            <@shiro.hasRole name="Admin">
            <tr>
                <td>
                    <label for="lead_text" art='label' required='true'><@s.message "project.form.lead"/></label>
                </td>
                <td>
                    <input id="lead_text" name="lead_text" type="text" art="combobox" required='true' value="${project.lead?html}" display="right" requiredMsg="<@s.message "project.edit.leader.error.tip"/>"/>
                </td>
            </tr>
            <tr>
                <td>
                    <label for="dev_leader_text" art='label'><@s.message "project.form.dev_leader"/></label>
                </td>
                <td>
                    <input id="dev_leader_text" name="dev_leader_text" type="text" art="combobox" value="${project.dev_leader?html}" display="right" />
                </td>
            </tr>
            </@shiro.hasRole>
            <tr>
                <td>
                    <label for="team" art='label' required='true'><@s.message "project.form.team"/></label>
                </td>
                <td>
                    <input type="hidden" id="teamAccount" name="teamAccount" value="${teamAccount}">
                    <input type="hidden" id="team" name="team" value="${project.team}">
                    <input id="team_label" name="team_label" type="text" art="textbox" required="true"
                           emptyText="<@s.message "project.form.team.tip"/>" value="${teamNames}" readonly="true" display="tip"requiredMsg="<@s.message "project.edit.team.error.tip"/>"/>
                    <input art="button" id="choose_team_account" text="<@s.message 'project.form.team_account'/>">
                </td>
            </tr>
            <tr>
                <td>
                    <label for="description" art='label'><@s.message "project.form.description"/></label>
                </td>
                <td>
                    <input id="description" name="description" type="text" art="textbox" value="${project.description?html}"/>
                </td>
            </tr>
			<#if project.id != 0>
            <tr>
                <td>
                    <label art='label'><@s.message "project.form.tool"/></label>
                </td>
                <td>
                    <textarea id="txt" art="textbox"  readonly="readonly" width="480px" height="150px" style="resize:none">${project.tool_url}</textarea>
                </td>
            </tr>
			</#if>
            <tr id='tr_form_msg'>
                <td colspan="2"></td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <button id="btn_submit" type="button" onclick="project_edit.form_submit()">
                        <span><span><@s.message "operation.save"/></span></span>
                    </button>
                </td>
            </tr>
        </table>
    </form>
    <div id="layer1" style="display:none;">
        <div>
            <select id="team_account_select" name="team_account_select" multiple="multiple">
            </select>
            <button id="choose_account" type="button" onclick="javascript:project_edit.choose_account();">
                <span><span><@s.message "operation.confirm"/></span></span>
            </button>
        </div>
    </div>
</@override>
<@override name="scripts">
    <script type="text/javascript">
        var teamAccout_json =  ${teamAccout_json};
        var js_param = {
            pid_param: ${project.id}
        };
    </script>
    <script type="text/javascript" src="<@s.url '/resources/scripts/project/edit.js'/>"></script>
    <script type="text/javascript" src="<@s.url '/resources/common/plugins/jquery.ui.widget.min.js'/>"></script>
    <script type="text/javascript" src="<@s.url '/resources/common/plugins/jquery-picklist.min.js'/>"></script>

</@override>

<#if project.id==0>
	<#assign title="project.location.add"/>
<#else>
	<#assign title="project.location.edit"/>
</#if>

<@extends name="/common/layout.ftl" current="project" title='${title}'></@extends>